<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import { apigetUserInfo } from "@/api";
import { mapMutations } from 'vuex'
export default {
  created() {
    if (localStorage.getItem("token")) {
      this.getUserInfo();
    }
  },
  methods: {
    ...mapMutations(["CHANGE_USER_INFO"]),
    getUserInfo() {
      // 获取用户信息
      apigetUserInfo().then((res) => {
        this.CHANGE_USER_INFO(res.data)
      });
    },
  },
};
</script>

<style lang="scss">
html,
body,
#app {
  width: 100%;
  height: 100%;
}
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
}
</style>
